package com.suixun.controller;

import com.suixun.controller.base.BaseController;
import com.suixun.domain.CooperationPartnerDisplay;
import com.suixun.service.CooperationPartnerDisplayService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/cooperationPartner")
public class CooperationPartnerDisplayController extends BaseController {

    @Resource
    private CooperationPartnerDisplayService cooperationPartnerDisplayService;


    @PostMapping("/add")
    public Object insert(CooperationPartnerDisplay cooperationPartnerDisplay, Boolean isTop) {
        cooperationPartnerDisplayService.insert(cooperationPartnerDisplay, isTop);
        return success();
    }

    @GetMapping("/get/{id}")
    public Object get(@PathVariable Integer id) {
        return success(cooperationPartnerDisplayService.getById(id));
    }

    @GetMapping("/page/{page}/{size}")
    public Object page(@PathVariable Integer page, @PathVariable Integer size, String title) {
        return success(cooperationPartnerDisplayService.pageExclusionContent(page, size,title, 1));
    }

    @PostMapping("/update")
    public Object update(CooperationPartnerDisplay cooperationPartnerDisplay, Boolean isTop) {
        cooperationPartnerDisplayService.update(cooperationPartnerDisplay, isTop);
        return success();
    }

    @PostMapping("/delete")
    public Object delete(String ids) {
        cooperationPartnerDisplayService.delete(ids);
        return success();
    }
}
